const path = require('path')

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  publicPath: './',
  outputDir: 'zhydjkhbdh/zhydjkhbdh',
  assetsDir: './apph5/zhydjkhbdh/',
  productionSourceMap: false,
  lintOnSave: false,
  devServer: {
    port: 8060,
    open: false,
    overlay: {
      warnings: false,
      errors: true
    },
    proxy: {
      '/api': {
        target: 'https://gd.10086.cn/apph5/openapi/app/handle',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    },
  },
  configureWebpack: {
    name: '2021年集客和包兑换',
    resolve: {
      alias: {
        'vendor': resolve('src/vendor'),
        '@': resolve('src')
      }

    }
  },
  chainWebpack(config) {
    config.optimization.splitChunks({
      chunks: 'all',
      cacheGroups: {
        libs: {
          name: 'chunk-libs',
          test: /[\\/]node_modules[\\/]/,
          priority: 10,
          chunks: 'initial'
        },
        elementUI: {
          name: 'chunk-elementUI',
          priority: 20,
          test: /[\\/]node_modules[\\/]_?element-ui(.*)/
        }
      }
    })
    config.optimization.runtimeChunk('single')
  }

}
